import ajax from '../../utils/requestsph'



// 添加购物车请求
export const reqAddOrUpdateCart = (skuId:Number,skuNum:Number) => ajax.post(`/api/cart/addToCart/${skuId}/${skuNum}`)

// 获取购物车数据
export const reqShopCartListData = () => ajax.get('/api/cart/cartList')

// 更新购物车选中状态
export const reqUpdateShopCartListData = (skuId:Number,isChecked:any) => ajax.get(`/api/cart/checkCart/${skuId}/${isChecked}`)

// 批量更新购物车商品选中状态
export const reqChangeAllCartState = (isChecked:Number,skuIdList:any) => ajax({
    url:`/api/cart/batchCheckCart/${isChecked}`,
    method:'post',
    data:skuIdList
})

// 删除购物车一条商品数据
export const reqDelOneShopCartGoods = (skuId:Number) => ajax.delete(`/api/cart/deleteCart/${skuId}`)

// 批量删除购物车商品
export const reqDelManyShopCartGoods = (skuIdList:Number[]|String[]) =>ajax.post('/api/cart/batchDeleteCart',skuIdList)

// 获取邮寄地址
export const reqGetUserAddressList = () => ajax.get('/api/user/userAddress/auth/findUserAddressList')

// 获取订单数据
export const reqTradeInfoData = () => ajax.get('/api/order/auth/trade')

// 提交订单
export const reqSubmitTradeOrder = (tradeNo,params)=>ajax.post(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`,params)

// 获取支付二维码
export const reqGetPayQRcode = (orderId)=>ajax.get(`/api/payment/weixin/createNative/${orderId}`)

// 查询支付订单状态 是否成功支付
export const reqPayStatus = (orderId)=> ajax.get(`/api/payment/weixin/queryPayStatus/${orderId}`)